<?php
class UserBase
{
	public $userid = 0;
	public $username = null;
	public $logined = false;
	public $mobile = "";
	public $level = 0;
	public $usertype = 0;
	public $com_name = '';

	function __construct()
	{
		if(!array_key_exists('user', $_SESSION))
			return;
		$obj = $_SESSION['user'];
		if($obj['keep'] == 0 && $obj['logintime'] <=  time(0) - 1800)			//30分钟不操作登录失效
		{
			unset($_SESSION['user']);
			return 0;
		}
		$this->basedata = $obj;
		$this->userid= $obj['id'];
		$this->username = $obj['name'];
		$this->com_name = $obj['com_name'];
		$this->mobile = $obj['mobile'];
		$this->level = $obj['level'];
		$this->usertype = $obj['usertype'];
		$this->logined = true;
	}
	
	function Active()
	{
		if($this->logined)
			$_SESSION['user']['logintime'] = time(0);
	}
};

